package com.ocom.security.config;

import lombok.AllArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.security.web.access.AccessDeniedHandler;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.ocom.security.authentication.YoCiAccessDeniedHandler;
import com.ocom.security.authentication.YoCiAuthenticationEntryPoint;


@AllArgsConstructor
public class AuthenticationBeanConfig {

	private final ObjectMapper objectMapper;

	@Bean
	public AccessDeniedHandler accessDeniedHandler() {
		return new YoCiAccessDeniedHandler(objectMapper);
	}

	@Bean
	public AuthenticationEntryPoint authenticationEntryPoint() {
		return new YoCiAuthenticationEntryPoint(objectMapper);
	}

}
